import {createRouter, createWebHashHistory} from 'vue-router'

import Home from "@/views/home/Home.vue"

// 路由配置
const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home,
        children: [
            {
                path: '/',
                name: 'Welcome',
                component: () => import('@/views/home/Wellcom.vue'),
                children: []
            },
            {
                path: '/fileUpload',
                name: 'FileUpload',
                component: () => import('@/views/system/fileUpload/FileUploadPage.vue'),
            },
            {
                path: '/user',
                name: 'User',
                children: [
                    {
                        path: '/user/page',
                        name: 'UserPage',
                        component: () => import('@/views/system/user/UserPage.vue'),
                    },
                    {
                        path: '/user/role',
                        name: 'UserRolePage',
                        component: () => import('@/views/system/user/UserRolePage.vue'),
                    },
                    {
                        path: '/user/center',
                        name: 'UserCenter',
                        component: () => import('@/views/system/user/userCenter/UserCenterLayout.vue'),
                    }
                ]
            },
            {
                path: '/level',
                children: [
                    {
                        path: '/level/page',
                        name: 'Level',
                        component: () => import('@/views/system/level/LevelPage.vue'),
                    },
                    {
                        path: '/levelUpEvent/page',
                        name: 'LevelUpEvent',
                        component: () => import('@/views/system/level/LevelUpEventPage.vue'),
                    },
                ]
            },
            {
                path: '/post',
                children: [
                    {
                        path: '/post/page',
                        name: 'PostPage',
                        component: () => import('@/views/system/post/PostPage.vue'),
                    },
                    {
                        path: '/post/approvalPage',
                        name: 'LevelUpEvent',
                        component: () => import('@/views/system/post/PostApprovalPage.vue'),
                    },
                ]
            },
            {
                path: '/fileUpload',
                name: 'FileUpload',
                component: () => import('@/views/system/fileUpload/FileUploadPage.vue'),
            },
            {
                path: '/userSelfDetail',
                name: 'UserSelfDetail',
                component: () => import('@/views/system/user/selfDetail/UserSelfDetail.vue'),
            },
            {
                path: '/menu',
                name: 'Menu',
                component: () => import('@/views/system/menu/MenuPage.vue'),
            },
        ]
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import("@/views/auth/Login.vue")
    },]

// 创建路由实例
const router = createRouter({
    history: createWebHashHistory(), routes
})

export default router